package com.frxuexi.park2305.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.SPUtils
import com.frxuexi.lib_base.http.Const
import com.frxuexi.lib_base.mvi.BaseViewFragment
import com.frxuexi.lib_base.utils.ArouterManager
import com.frxuexi.park2305.R
import com.frxuexi.park2305.databinding.FragmentMineBinding


class MineFragment : BaseViewFragment<FragmentMineBinding>() {
    override val binding: FragmentMineBinding by lazy { FragmentMineBinding.inflate(layoutInflater) }

    override fun initView() {
        binding.myUname.setText(SPUtils.getInstance().getString(Const.UNAME,"未登录"))

        binding.mychange.setOnClickListener {
            SPUtils.getInstance().apply {
                remove(Const.TOKEN)
                remove(Const.ROLE)
                remove(Const.UNAME)
                remove(Const.UID)
            }
            ARouter.getInstance().build("/app/LoginActivity").navigation()
        }

        binding.myfavIv.setOnClickListener {
            ArouterManager.nav(requireContext(),"/app/MyApplyActivity")
        }

        binding.myapproveIv.setOnClickListener {
            ArouterManager.nav(requireContext(),"/app/MyApproveActivity")
        }

        binding.mybillIv.setOnClickListener {
            ArouterManager.nav(requireContext(),"/shop/OrderActivity")
        }
    }

}